<?php
/**
 * Created by PhpStorm.
 * User: zhangxilu
 * Date: 2017/12/27
 * Time: 下午11:46
 */

namespace frontend\modules\v1\controllers;


use common\logic\FavoriteLogic;
use frontend\common\ApiController;

class FavoriteController extends ApiController
{
    public function actionEdit(){
        $uid = \Yii::$app->request->get('uid');
        $house_id = \Yii::$app->request->get('house_id');
        $status = \Yii::$app->request->get('status');

        if(empty($uid) || empty($house_id)){
            return $this->error('参数不正确');
        }

        $rs = FavoriteLogic::instance()->favorite($uid,$house_id,$status);
        if(is_string($rs)){
            return $this->error($rs);
        }
        return $this->success([]);
    }

    public function actionList(){
        $uid = \Yii::$app->request->get('uid');
        if(empty($uid)){
            return $this->error('参数不正确');
        }

        $rs = FavoriteLogic::instance()->getList($uid);
        if(is_string($rs)){
            return $this->error($rs);
        }
        return $this->success($rs);
    }
}